public class WhileTest {
    static boolean condition() {
        double d = Math.random();
        boolean result = d < 0.99;
        System.out.println("Math.random(): " + d + ", result: " + result);
        return result;
    }

    public static void main(String[] args) {
        int count = 0;
        while (condition()) {
            System.out.println("inside while");
            count++;
        }
        System.out.println("count: " + count);
        System.out.println("outside while");
    }
}
